package com.yubest.client.config;

import com.yubest.tool.bean.LicenseVerifierParam;
import com.yubest.tool.manage.MyLicenseManager;
import de.schlichtherle.license.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @Author hweiyu
 * @Description
 * @Date 2022/6/16 9:14
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Component
@ConfigurationProperties(prefix = "license")
public class LicenseConfig extends LicenseVerifierParam {

    @Bean
    public LicenseManager licenseManager() {
        LicenseParam param = toLicenseParam(LicenseConfig.class);
        return new MyLicenseManager(param);
    }

}
